﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using HslCommunication.Controls;

namespace HslCommunication.BasicFramework
{
	/// <summary>
	/// 用来测试版软件授权的窗口
	/// </summary>
	// Token: 0x02000185 RID: 389
	public partial class FormAuthorize : Form
	{
		/// <summary>
		/// 实例化授权注册窗口
		/// </summary>
		/// <param name="authorize"></param>
		/// <param name="aboutCode">提示关于怎么获取注册码的信息</param>
		/// <param name="encrypt">加密的方法</param>
		// Token: 0x06001FB5 RID: 8117 RVA: 0x00099CB4 File Offset: 0x00097EB4
		public FormAuthorize(SoftAuthorize authorize, string aboutCode, Func<string, string> encrypt)
		{
			this.InitializeComponent();
			this.softAuthorize = authorize;
			this.AboutCode = aboutCode;
			this.Encrypt = encrypt;
		}

		// Token: 0x06001FB6 RID: 8118 RVA: 0x00099D06 File Offset: 0x00097F06
		private void FormAuthorize_Load(object sender, EventArgs e)
		{
			this.textBox1.Text = this.softAuthorize.GetMachineCodeString();
		}

		// Token: 0x06001FB7 RID: 8119 RVA: 0x00099D20 File Offset: 0x00097F20
		private void userButton1_Click(object sender, EventArgs e)
		{
			bool flag = this.softAuthorize.CheckAuthorize(this.textBox2.Text, this.Encrypt);
			if (flag)
			{
				base.DialogResult = DialogResult.OK;
			}
			else
			{
				MessageBox.Show("注册码不正确");
			}
		}

		// Token: 0x17000691 RID: 1681
		// (get) Token: 0x06001FB8 RID: 8120 RVA: 0x00099D67 File Offset: 0x00097F67
		// (set) Token: 0x06001FB9 RID: 8121 RVA: 0x00099D6F File Offset: 0x00097F6F
		private string AboutCode { get; set; } = "";

		// Token: 0x06001FBA RID: 8122 RVA: 0x00099D78 File Offset: 0x00097F78
		private void linkLabel1_Click(object sender, EventArgs e)
		{
			MessageBox.Show(this.AboutCode);
		}

		// Token: 0x0400075E RID: 1886
		private SoftAuthorize softAuthorize = null;

		// Token: 0x0400075F RID: 1887
		private Func<string, string> Encrypt = null;
	}
}
